package com.lxy.util;

import com.lxy.myweather.R;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

public class List_Adapter extends BaseAdapter {
	private String[] listName={"舒适度指数:","紫外线指数:","晨练指数:",
								"过敏指数:","洗车指数:","旅游指数:",
								"晾晒指数:","着装指数:"};
	private String [] list_content;
	private LayoutInflater inflater = null;
	private Context context = null;
	
	public List_Adapter(String [] list_content,Context context){
		this.list_content=list_content;
		this.context=context;
		
	}
	
	public List_Adapter(Context context){
		this.context=context;
		list_content=new String[]{"舒适度指数:","紫外线指数:","晨练指数:",
				"过敏指数:","洗车指数:","旅游指数:",
				"晾晒指数:","着装指数:着装指数:着装指数:着装指数:着装指数:着装指数:着装指数:着装指数:"};
	}
	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return list_content.length;
	}

	@Override
	public Object getItem(int arg0) {
		// TODO Auto-generated method stub
		return list_content[arg0];
	}

	@Override
	public long getItemId(int position) {
		// TODO Auto-generated method stub
		return position;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		inflater = LayoutInflater.from(this.context);
		TextView t1;
		TextView t2;
		if (convertView == null) {
			convertView = inflater.inflate(R.layout.list_item,null);
		} 
		t1=(TextView) convertView.findViewById(R.id.item_title);
		t2=(TextView) convertView.findViewById(R.id.item_content);
		t1.setText(listName[position]);
		t2.setText(list_content[position]);

		return convertView;
	}

}
